// Write a loop that opens multiple files build a new tree each time and emit it.
// Write a new opt pass EmitRuntimeCode, put the loop the generate all needed
// files and call EmitC
// grep EmitC `find . -name *java`

#include "AutoGenSupport.hpp"

#ifdef __EDT_DECL__
RSTREAM_EDT_DECL(0, 7, 3)
#endif // __EDT_DECL__

#ifdef __EDT_INITIALIZATION__
  RSTREAM_EDT_INITIALIZATION(0, TASKTAGDIMMACRO, INTERTASKDIMMACRO)
#endif // __EDT_INITIALIZATION__

#ifdef __DEP_DIST_DEF__
  RSTREAM_DEP_DIST_DEF((ConstantTerm)1, (ConstantTerm)1, (ConstantTerm)1)
#endif // __DEP_DIST_DEF__

#ifdef __TAG_TABLE_EXTERN_DECL__
RSTREAM_TAG_TABLE_EXTERN_DECL(0, 7, 3)
#endif // __TAG_TABLE_EXTERN_DECL__

#ifdef __DEP_ET_DEF__
ET_DECL_IV(t1, 1, termsE)
ET_DECL_IV(t2, 2, termsE)
ET_DECL_IV(t3, 3, termsE)
ET_DECL_IV(pT, 4, termsE)
ET_DECL_IV(pM, 5, termsE)
ET_DECL_IV(pN, 6, termsE)
ET_DECL_IV(pP, 7, termsE)
static constexpr auto p1 = 
    FOR(t1, CEIL(-pN-15,16), FLOOR(pT-3,16));
static constexpr auto p2 = 
  FOR(t2, MAX(t1,-t1-1), 
      MIN(MIN(FLOOR(-8*t1+pT-2,8),FLOOR(8*t1+pN+7,8)),FLOOR(pT+pN-2,16)));
static constexpr auto p3 = 
  FOR (t3, MAX(MAX(0,CEIL(t1+t2-1,2)),CEIL(16*t2-pN-14,16)), 
       MIN(MIN(FLOOR(pT+pN-2,16),FLOOR(16*t2+pN+14,16)),FLOOR(8*t1+8*t2+pN+15,16)));

static constexpr auto lbsE = 
  std::make_tuple(ConstantTerm(), 
                  (t1 >= p1.first), (t2 >= p2.first), (t3 >= p3.first));
static constexpr auto ubsE = 
  std::make_tuple(ConstantTerm(), 
                  (t1 <= p1.second), (t2 <= p2.second), t3 <= (p3.second));
#endif // __DEP_ET_DEF__
